import React, { Component } from 'react';
import { observer } from "mobx-react";
import { View, Text, Alert } from 'react-native';
import { Actions, Scene } from 'react-native-router-flux';
import styles from './styles';
import CheckMobile from '../../start/components/checkMob';
import user from '../../../common/models/user'
import navBarStyle from '../../../components/navBarStyle';

@observer
class BindMobile extends Component {
  submitHandle = values => {
    this.props.user.bindMobile(values);
  };
  sendHandle = (mobile, action) => {
    this.props.user.sendSmsCode(mobile, action);
  };
  render() {
    return (
      <View style={styles.content}>
        <CheckMobile
          sendAction={this.sendHandle}
          onSubmit={this.submitHandle}
          sendError={this.props.user.sendError}
          submitText="绑定手机号"
          action={2}
        />
      </View>
    );
  }
}

module.exports = (
  <Scene
    key="personalBindMobile"
    component={BindMobile}
    hideTabBar
    title="绑定手机号"
    path="/personal/bindMobile"
    user={user}
    {...navBarStyle}
  />
);
